package com.boesch.electroOffice.business.businessObjectImpl;

import java.io.Serializable;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.boesch.electroOffice.business.businessObject.InvoiceBusinessObject;
import com.boesch.electroOffice.business.common.BusinessException;
import com.boesch.electroOffice.dataaccess.common.IllegalDataAccessException;
import com.boesch.electroOffice.dataaccess.dao.messerli.InvoiceDao;
import com.boesch.electroOffice.model.messerli.Invoice;

/**
 * This class handles all the business logic 
 * for package com.boesch.electroOffice.application.invoice
 * 
 * If there is no business logic, the class just calls the appropriate class
 * from package com.boesch.electroOffice.dataaccess to read the data from database
 * 
 * 
 * @author Ralph Koster
 *
 */
@Service
public class InvoiceBusinessObjectImpl implements InvoiceBusinessObject, Serializable {

	private static final long serialVersionUID = -3251458756863123451L;

	@Autowired
	private InvoiceDao invoiceDao;	
	
	public List<Invoice> readAllInvoicesFromDataaccess() 
			throws BusinessException, IllegalDataAccessException {
		return invoiceDao.readAllInvoices();
	}

	public Invoice readInvoiceByInvoiceNumber(String invoiceNumber)
			throws BusinessException, IllegalDataAccessException {
		return invoiceDao.readInvoiceByInvoiceNumber(invoiceNumber);
	}

}
